import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/pages/search/index.dart';
import 'package:flutter_demo/ui/pages/treasure/module/lt_scene_vos.dart';
import 'package:flutter_demo/ui/pages/treasure/widgets/title_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class KeyWordWidget extends StatelessWidget {
  LtSceneVOS lst;
  KeyWordWidget(this.lst, {super.key});

  @override
  Widget build(BuildContext context) {
    final list = <Widget>[];
    lst.categorySub?.forEach(
      (e) {
        list.add(ActionChip(
          label: Text(e),
          labelStyle: const TextStyle(color: Colors.black54),
          backgroundColor: Colors.orange,
          onPressed: () {
            Get.toNamed(SearchPage.routeName,
                arguments: {"keywords": e, "channel": "2"});
          },
        ));
      },
    );

    return Container(
        margin: EdgeInsets.only(left: 20.w, right: 20.w),
        child: Column(
          children: [
            TitleWidget(
              title: lst.category!,
              titleImage: "icon_play_small",
            ),
            SizedBox(
              width: 1.sw,
              child: Wrap(
                spacing: 5.0,
                //主轴间距
                runSpacing: 8.0,
                //主轴上的对齐方式
                crossAxisAlignment: WrapCrossAlignment.start,
                alignment: WrapAlignment.start,
                children: list,
              ),
            ),
          ],
        ));
  }
}
